package com.ghosthigh.simpleaccount.shared.model;

import java.util.Date;

import javax.persistence.Id;

/**
 *  Represents a user.
 */
public class UserAccount {

  /**
   * Id value obtained by
   * <code>com.google.appengine.api.users.User#getUserId</code>
   */
  @Id String userId;

  String displayedName;

  String email;

  Date joinDate;

  Date terminatedDate;

  Date lastLogin;

  public static UserAccount asNewUser(String userId, String displayedName, String email, Date currentDate) {
    return new UserAccount(userId, displayedName, email, currentDate);
  }

  private UserAccount(String userId, String displayedName, String email, Date currentDate) {
    this.userId = userId;
    this.displayedName = displayedName;
    this.email = email;
    this.joinDate = currentDate;
  }

  public String getUserId() {
    return userId;
  }

  public String getDisplayedName() {
    return displayedName;
  }

  public void setDisplayedName(String displayedName) {
    this.displayedName = displayedName;
  }

  public Date getJoinDate() {
    return joinDate;
  }

  public Date getTerminatedDate() {
    return terminatedDate;
  }

  public void setTerminatedDate(Date terminatedDate) {
    this.terminatedDate = terminatedDate;
  }

  public Date getLastLogin() {
    return lastLogin;
  }

  public void setLastLogin(Date lastLogin) {
    this.lastLogin = lastLogin;
  }

  public String getEmail() {
    return email;
  }

}
